package com.xiaotu.dao.mysql;

import com.xiaotu.entity.SyncHotSwIndexModel;
import com.xiaotu.entity.SyncSwIndexModel;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author zhangxiao
 * @create 2021-11-01 15:01
 */
public interface MysqlSwIndexMapper {

    @Delete("<script>" +
            " DELETE FROM ${tableName} " +
            "</script>")
    void clearAll(@Param("tableName") String tableName);

    @Insert("<script>" +
            " INSERT INTO `screenwriter`.`tab_sw_hot`(`starid`, `order_num`) VALUES " +
            " <foreach collection='list' item='v' separator=','>" +
            " (#{v.starid}, #{v.orderNum}) " +
            " </foreach> " +
            " ; " +
            "</script>")
    void batchInsertHotSwIndex(@Param("list") List<SyncHotSwIndexModel> sources);

    @Insert("<script>" +
            " INSERT INTO `screenwriter`.`tab_actor_index`(`starid`, `starname`, `tv_nettv_xtindex`, `movie_nettv_xtindex`, `netmovie_xtindex`) VALUES  " +
            " <foreach collection='list' item='v' separator=','>" +
            " (#{v.starid}, #{v.starname},#{v.tv_nettv_xtindex},#{v.movie_nettv_xtindex},#{v.netmovie_xtindex}) " +
            " </foreach> " +
            " ; " +
            "</script>")
    void batchInsertSwIndex(@Param("list") List<SyncSwIndexModel> sources);
}
